<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [8, 3, 32, 21, 1]; //数组是array,但是检测显示是object;
        console.log(typeof arr);
        // 如果要判断是否是数组array,用instanceof Array
        if (typeof arr == 'array') {
            alert('不会弹出');
        };
        if (typeof arr == 'object') {
            alert('我会弹出');
        };
        if (arr instanceof Array) {
            alert('instanceof后是Array,会弹出');
        };
        if (arr instanceof Object) {
            alert('instanceof后是Object,会弹出');
        }
    </script>

</body>

</html>